package com.rocketmq.consumer;

import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * 广播模式（广播模式的消费组名称不能重复）
 * @author ytj
 * @date 2024/10/10 16:31
 */
@Component
@RocketMQMessageListener(consumerGroup = "boot-product-broadcast",topic = "broadcast_test",messageModel = MessageModel.BROADCASTING)
public class BroadcastingTest implements RocketMQListener<String> {
    @Override
    public void onMessage(String messageExt) {
        System.out.println("rocketmq接收消息为:"+messageExt);
    }
}
